<template>
  <el-dialog :title="title" :visible.sync="visible" width="900px" append-to-body>
    <el-table v-loading="loading" :data="tableData">
      <el-table-column width="250" label="销售订单编号" align="center" prop="saleOrderId"/>
      <el-table-column width="150" label="应付" align="center" prop="accountDto.shouldPayAmt"/>
      <el-table-column width="100" label="实付" align="center" prop="accountDto.factRecvAmt"/>
      <el-table-column width="100" label="差额" align="center">
        <template slot-scope="scope">
          <span>{{scope.row.accountDto.shouldPayAmt-scope.row.accountDto.factRecvAmt}}</span>
        </template>
      </el-table-column>
      <el-table-column width="150" label="授信金额" align="center" prop="creditAmount"/>
      <el-table-column width="100" label="实际授信金额" align="center" prop="sjAmount"/>
    </el-table>
  </el-dialog>
</template>

<script>
import {
  getCreditList,
} from "@/api/salepurchase/saleorder"

export default {
  name: "creditindex",
  data() {
    return {
      title: "详情",
      // 遮罩层
      loading: true,
      // 是否显示弹出层
      visible: false,
      // 总条数
      total: 0,
      // 表格数据
      tableData: [],
      // 查询参数
      queryParams: {
        id: ""

      },

    }
  },
  methods: {
    /** 查询合同列表 */
    open(id) {
      console.log(id)
      this.visible = true;
      this.queryParams.id=id;
      if (id) {
        getCreditList(this.queryParams).then(response => {
          this.tableData = response.data
          this.loading=false;
        })
      }
    },
    // 取消按钮
    cancel() {
      this.visible = false
      this.reset()
    },

  }
}
</script>
